package Dome;

public class Text {
    public static void fun(Animal a){
        a.eat();
    }

    public static void main(String[] args) {
      Animal animal1=new Dog("圆圆",19);
      Animal animal2=new Cat("方方",17);
      animal1.Father();
      fun(animal1);
      fun(animal2);
    }
}

class Text2{
    public static void main(String[] args) {
        Animal a1=new Dog("haha",8);
//        a1.cry();
        if(a1 instanceof Dog){
            Dog dog=(Dog) a1;
            dog.cry();
        }
    }
}
